<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title> CallLib </title>
  <link rel="stylesheet" href="../res/rongcloud.css">
  <link rel="stylesheet" href="style/main.css">
</head>
<body>
  <a href="https://github.com/rongcloud/websdk-demo/blob/master/calllib/blink/private.html" class="get-source">获取源码</a>
  <div class="rong-container"></div>
   <div class="rong-toolbar">
      <button onclick="callVideo()" class="rong-callvideo"></button>
      <button onclick="callAudio()" class="rong-callaudio"></button>
      
      <button onclick="acceptVideo()" class="rong-accept"></button>
      <button onclick="hungup()" class="rong-hungup"></button>
      
      <button onclick="mute()" class="rong-mute"></button>
      <button onclick="unmute()" class="rong-unmute"></button>

      <button onclick="videoToAudio()" class="rong-disable-video"></button>
      <button onclick="audioToVideo()" class="rong-disable-audio"></button>
  </div>
  </div>
  <h2 class="rong-notice">公告：此 Demo 即将废弃，后续不再维护，同时会推出新示例</h2>
  <div class="rong-warns">
    <p>兼容说明：</p>
    <ul>
      <li>操作系统: macOS 10.13.3+ 、Win7+</li>
      <li>浏览器: Chrome 57+</li>
    </ul>
    <p>站点要求：</p>
    <ul>
      <li>HTTPS 站点或 localhost, 端口不限</li>
    </ul>
  </div>
</body>
  <script src="//cdn.ronghub.com/RongIMLib-2.5.1.js"></script>
  <script src="//cdn.ronghub.com/RongCallLib-3.0.0.min.js"></script>
  <script src="./init.js"></script>
  <script src="./demo.js"></script>
  <script>
    var config = {
      appKey: 'appkey',
      groupId: 'mBze1232Cm',
      members: [{
        id: 'XDdddLn7p',
        token: '48WQuGNLvftw4xaa/DrZEyJMsLZ9PPIg+8Ph5+QmAtoP6tdpZUyLdaH'
      }, {
        id: 'Qlyv123T',
        token: 'KM7HOjWA2JPgQ/joNtsdS1YEkeV2IKH+AY1qZPXnLINfK'
      },{
        id: 'RffffM6h',
        token: 'X1LcAANGwXDJjWfmuNGHu3xpRjANxKgfakOnYL9zWv+8tfUu6WVQ=='
      }]
    };

    var params = (function(config){
        var members = config.members;  
        var appKey = config.appKey;

        var index = location.search.slice(1) || 0;
        var member = members[index];
        var inviteUsers = members.filter(function(_member){
          return _member.id != member.id;
        });
        var inviteUserIds = inviteUsers.map(function(_member){
          return _member.id; 
        });
        return {
          appKey: appKey,
          conversationType: 3,
          userId: member.id,
          inviteUserIds: inviteUserIds,
          token: member.token,
          targetId: config.groupId
        };
    })(config);

    var callbacks = {
        getInstance : function(instance){
           var toolbar = tools.getDom('.rong-toolbar')[0];
           toolbar.style.display = 'block';
        },
        getCurrentUser : function(userInfo){
            console.log(userInfo.userId);
        }
    };

    IMLib.init(params, callbacks);
  </script>

</html> 